use strict;
use warnings;

    my %hRow_cut =           ("E9200" => 1,"E9201" => 1,"E9202" => 1,"E9203" => 1,"E9204" => 1,"E9205" => 1,"E9208" => 1,"E9209" => 1,"E9560" => 1,"E9660" => 1,"E9740" => 1,"E9860" => 1);
    my %hRow_drown =         ("E8300" => 1,"E8301" => 1,"E8302" => 1,"E8303" => 1,"E8304" => 1,"E8305" => 1,"E8306" => 1,"E8308" => 1,"E8309" => 1,"E8320" => 1,"E8321" => 1,"E8322" => 1,"E8323" => 1,"E8324" => 1,"E8325" => 1,"E8326" => 1,
                             "E8328" => 1,"E8329" => 1,"E9100" => 1,"E9101" => 1,"E9102" => 1,"E9103" => 1,"E9104" => 1,"E9108" => 1,"E9109" => 1,"E9540" => 1,"E9640" => 1,"E9840" => 1);
    my %hRow_fallBldg =      ("E8820" => 1);
    my %hRow_fallFurn =      ("E8842" => 1,"E8844" => 1,"E8845" => 1);
    my %hRow_fallHgt =       ("E8800" => 1,"E8801" => 1,"E8810" => 1,"E8811" => 1,"E8830" => 1,"E8831" => 1,"E8832" => 1,"E8839" => 1,"E8841" => 1,"E8843" => 1,"E8846" => 1,"E8849" => 1,"E9570" => 1,"E9571" => 1,"E9572" => 1,"E9579" => 1,
                             "E9681" => 1,"E9870" => 1,"E9871" => 1,"E9872" => 1,"E9879" => 1);
    my %hRow_fallOther =     ("E8880" => 1,"E8880" => 1,"E8881" => 1,"E8888" => 1,"E8889" => 1);
    my %hRow_fallPlay =      ("E8840" => 1);
    my %hRow_fallSame =      ("E8850" => 1,"E8850" => 1,"E8851" => 1,"E8852" => 1,"E8853" => 1,"E8854" => 1,"E8859" => 1,"E8860" => 1,"E8869" => 1);
    my %hRow_fallStair =     ("E8809" => 1);
    my %hRow_burn =          ("E8900" => 1,"E8901" => 1,"E8902" => 1,"E8903" => 1,"E8908" => 1,"E8909" => 1,"E8910" => 1,"E8911" => 1,"E8912" => 1,"E8913" => 1,"E8918" => 1,"E8919" => 1,"E8920" => 1,"E8930" => 1,"E8931" => 1,"E8932" => 1,
                              "E8938" => 1,"E8939" => 1,"E8940" => 1,"E8950" => 1,"E8960" => 1,"E8970" => 1,"E8980" => 1,"E8981" => 1,"E8990" => 1,"E9240" => 1,"E9241" => 1,"E9242" => 1,"E9248" => 1,"E9249" => 1,"E9581" => 1,"E9582" => 1,
                              "E9587" => 1,"E9610" => 1,"E9680" => 1,"E9683" => 1,"E9881" => 1,"E9882" => 1,"E9887" => 1);
    
    my %hRow_firearm =       ("E9220" => 1,"E9221" => 1,"E9222" => 1,"E9223" => 1,"E9224" => 1,"E9228" => 1,"E9229" => 1,"E9550" => 1,"E9551" => 1,"E9552" => 1,"E9553" => 1,"E9554" => 1,"E9650" => 1,"E9651" => 1,"E9652" => 1,"E9653" => 1,
                              "E9654" => 1,"E9700" => 1,"E9850" => 1,"E9851" => 1,"E9852" => 1,"E9853" => 1,"E9854" => 1);
    
    my %hRow_machAgri =      ("E9190" => 1);
    
    my %hRow_machOther =     ("E9191" => 1,"E9192" => 1,"E9193" => 1,"E9194" => 1,"E9195" => 1,"E9196" => 1,"E9197" => 1,"E9198" => 1,"E9199" => 1);
    
    my %hRow_MVTAnimal =     ("E8105" => 1,"E8115" => 1,"E8125" => 1,"E8135" => 1,"E8145" => 1,"E8155" => 1,"E8165" => 1,"E8175" => 1,"E8185" => 1,"E8195" => 1);
    
    my %hRow_MVTBike =       ("E8106" => 1,"E8116" => 1,"E8126" => 1,"E8136" => 1,"E8146" => 1,"E8156" => 1,"E8166" => 1,"E8176" => 1,"E8186" => 1,"E8196" => 1);
    
    my %hRow_MVTMotor =      ("E8102" => 1,"E8103" => 1,"E8112" => 1,"E8113" => 1,"E8122" => 1,"E8123" => 1,"E8132" => 1,"E8133" => 1,"E8142" => 1,"E8143" => 1,"E8152" => 1,"E8153" => 1,"E8162" => 1,"E8163" => 1,"E8172" => 1,"E8173" => 1,
                              "E8182" => 1,"E8183" => 1,"E8192" => 1,"E8193" => 1);
    
    my %hRow_MVTOcc =        ("E8100" => 1,"E8101" => 1,"E8104" => 1,"E8110" => 1,"E8111" => 1,"E8114" => 1,"E8120" => 1,"E8121" => 1,"E8124" => 1,"E8130" => 1,"E8131" => 1,"E8134" => 1,"E8140" => 1,"E8141" => 1,"E8144" => 1,"E8150" => 1,
                              "E8151" => 1,"E8154" => 1,"E8160" => 1,"E8161" => 1,"E8164" => 1,"E8170" => 1,"E8171" => 1,"E8174" => 1,"E8180" => 1,"E8181" => 1,"E8184" => 1,"E8190" => 1,"E8191" => 1,"E8194" => 1);
    
    my %hRow_MVTOther =      ("E8108" => 1,"E8118" => 1,"E8128" => 1,"E8138" => 1,"E8148" => 1,"E8158" => 1,"E8168" => 1,"E8178" => 1,"E8188" => 1,"E8198" => 1);
    
    my %hRow_MVTPed =        ("E8107" => 1,"E8117" => 1,"E8127" => 1,"E8137" => 1,"E8147" => 1,"E8157" => 1,"E8167" => 1,"E8177" => 1,"E8187" => 1,"E8197" => 1);
    
    
    my %hRow_MVTUnspec =     ("E8109" => 1,"E8119" => 1,"E8129" => 1,"E8139" => 1,"E8149" => 1,"E8159" => 1,"E8169" => 1,"E8179" => 1,"E8189" => 1,"E8199" => 1,"E9585" => 1,"E9685" => 1,"E9885" => 1);
    
    my %hRow_biknotmvt =     ("E8013" => 1,"E8023" => 1,"E8033" => 1,"E8043" => 1,"E8053" => 1,"E8063" => 1,"E8073" => 1,"E8206" => 1,"E8216" => 1,"E8226" => 1,"E8236" => 1,"E8246" => 1,"E8256" => 1,"E8261" => 1,"E8269" => 1);
    
    my %hRow_pednotmvt =     ("E8002" => 1,"E8012" => 1,"E8022" => 1,"E8032" => 1,"E8042" => 1,"E8052" => 1,"E8062" => 1,"E8072" => 1,"E8207" => 1,"E8217" => 1,"E8227" => 1,"E8237" => 1,"E8247" => 1,"E8257" => 1,"E8260" => 1,"E8270" => 1,
                              "E8280" => 1,"E8290" => 1);
    
    my %hRow_atv =           ("E8210" => 1,"E8210" => 1,"E8211" => 1,"E8212" => 1,"E8213" => 1,"E8214" => 1,"E8215" => 1,"E8218" => 1,"E8219" => 1);
    
    my %hRow_noatv =         ("E8000" => 1,"E8001" => 1,"E8008" => 1,"E8009" => 1,"E8010" => 1,"E8010" => 1,"E8011" => 1,"E8018" => 1,"E8019" => 1,"E8020" => 1,"E8020" => 1,"E8021" => 1,"E8028" => 1,"E8029" => 1,"E8030" => 1,"E8030" => 1,
                              "E8031" => 1,"E8038" => 1,"E8039" => 1,"E8040" => 1,"E8040" => 1,"E8041" => 1,"E8048" => 1,"E8049" => 1,"E8050" => 1,"E8050" => 1,"E8051" => 1,"E8058" => 1,"E8059" => 1,"E8060" => 1,"E8060" => 1,"E8061" => 1,
                              "E8068" => 1,"E8069" => 1,"E8070" => 1,"E8070" => 1,"E8071" => 1,"E8078" => 1,"E8079" => 1,"E8200" => 1,"E8201" => 1,"E8202" => 1,"E8203" => 1,"E8204" => 1,"E8205" => 1,"E8208" => 1,"E8209" => 1,"E8220" => 1,
                              "E8220" => 1,"E8221" => 1,"E8222" => 1,"E8223" => 1,"E8224" => 1,"E8225" => 1,"E8228" => 1,"E8229" => 1,"E8230" => 1,"E8230" => 1,"E8231" => 1,"E8232" => 1,"E8233" => 1,"E8234" => 1,"E8235" => 1,"E8238" => 1,
                              "E8239" => 1,"E8240" => 1,"E8240" => 1,"E8241" => 1,"E8242" => 1,"E8243" => 1,"E8244" => 1,"E8245" => 1,"E8248" => 1,"E8249" => 1,"E8250" => 1,"E8250" => 1,"E8251" => 1,"E8252" => 1,"E8253" => 1,"E8254" => 1,
                              "E8255" => 1,"E8258" => 1,"E8259" => 1,"E8262" => 1,"E8263" => 1,"E8264" => 1,"E8268" => 1,"E8272" => 1,"E8273" => 1,"E8274" => 1,"E8278" => 1,"E8279" => 1,"E8282" => 1,"E8284" => 1,"E8288" => 1,"E8289" => 1,
                              "E8294" => 1,"E8298" => 1,"E8299" => 1,"E8310" => 1,"E8311" => 1,"E8312" => 1,"E8313" => 1,"E8314" => 1,"E8315" => 1,"E8316" => 1,"E8318" => 1,"E8319" => 1,"E8330" => 1,"E8331" => 1,"E8332" => 1,"E8333" => 1,
                              "E8334" => 1,"E8335" => 1,"E8336" => 1,"E8338" => 1,"E8339" => 1,"E8340" => 1,"E8340" => 1,"E8341" => 1,"E8342" => 1,"E8343" => 1,"E8344" => 1,"E8345" => 1,"E8346" => 1,"E8348" => 1,"E8349" => 1,"E8350" => 1,
                              "E8350" => 1,"E8351" => 1,"E8352" => 1,"E8353" => 1,"E8354" => 1,"E8355" => 1,"E8356" => 1,"E8358" => 1,"E8359" => 1,"E8360" => 1,"E8360" => 1,"E8361" => 1,"E8362" => 1,"E8363" => 1,"E8364" => 1,"E8365" => 1,
                              "E8366" => 1,"E8368" => 1,"E8369" => 1,"E8370" => 1,"E8370" => 1,"E8371" => 1,"E8372" => 1,"E8373" => 1,"E8374" => 1,"E8375" => 1,"E8376" => 1,"E8378" => 1,"E8379" => 1,"E8380" => 1,"E8380" => 1,"E8381" => 1,
                              "E8382" => 1,"E8383" => 1,"E8384" => 1,"E8385" => 1,"E8386" => 1,"E8388" => 1,"E8389" => 1,"E8400" => 1,"E8401" => 1,"E8402" => 1,"E8403" => 1,"E8404" => 1,"E8405" => 1,"E8406" => 1,"E8407" => 1,"E8408" => 1,
                              "E8409" => 1,"E8410" => 1,"E8410" => 1,"E8411" => 1,"E8412" => 1,"E8413" => 1,"E8414" => 1,"E8415" => 1,"E8416" => 1,"E8417" => 1,"E8418" => 1,"E8419" => 1,"E8420" => 1,"E8426" => 1,"E8427" => 1,"E8428" => 1,
                              "E8429" => 1,"E8430" => 1,"E8430" => 1,"E8431" => 1,"E8432" => 1,"E8433" => 1,"E8434" => 1,"E8435" => 1,"E8436" => 1,"E8437" => 1,"E8438" => 1,"E8439" => 1,"E8440" => 1,"E8440" => 1,"E8441" => 1,"E8442" => 1,
                              "E8443" => 1,"E8444" => 1,"E8445" => 1,"E8446" => 1,"E8447" => 1,"E8448" => 1,"E8449" => 1,"E8450" => 1,"E8450" => 1,"E8458" => 1,"E8459" => 1,"E9586" => 1,"E9886" => 1);
    
    my %hRow_natural =       ("E9000" => 1,"E9001" => 1,"E9009" => 1,"E9010" => 1,"E9010" => 1,"E9011" => 1,"E9018" => 1,"E9019" => 1,"E9020" => 1,"E9020" => 1,"E9021" => 1,"E9022" => 1,"E9028" => 1,"E9029" => 1,"E9030" => 1,"E9040" => 1,
                              "E9041" => 1,"E9042" => 1,"E9043" => 1,"E9049" => 1,"E9050" => 1,"E9050" => 1,"E9051" => 1,"E9052" => 1,"E9053" => 1,"E9054" => 1,"E9055" => 1,"E9056" => 1,"E9057" => 1,"E9058" => 1,"E9059" => 1,"E9060" => 1,
                              "E9060" => 1,"E9061" => 1,"E9062" => 1,"E9063" => 1,"E9064" => 1,"E9065" => 1,"E9068" => 1,"E9069" => 1,"E9070" => 1,"E9080" => 1,"E9080" => 1,"E9081" => 1,"E9082" => 1,"E9083" => 1,"E9084" => 1,"E9088" => 1,
                              "E9089" => 1,"E9090" => 1,"E9090" => 1,"E9091" => 1,"E9092" => 1,"E9093" => 1,"E9094" => 1,"E9098" => 1,"E9099" => 1,"E9280" => 1,"E9281" => 1,"E9282" => 1,"E9283" => 1,"E9583" => 1,"E9883" => 1);
    
    my %hRow_overexert =     ("E8003" => 1);
        
    # Struck
    my %hRow_struckFell =    ("E9160" => 1);
    
    my %hRow_struckSport =   ("E9170" => 1);
    
    my %hRow_struckOther =   ("E9171" => 1,"E9172" => 1,"E9173" => 1,"E9174" => 1,"E9175" => 1,"E9176" => 1,"E9177" => 1,"E9178" => 1,"E9179" => 1,"E9600" => 1,"E9682" => 1,"E9730" => 1,"E9750" => 1);
    
    my %hRow_suffoc =        ("E9110" => 1,"E9120" => 1,"E9130" => 1,"E9131" => 1,"E9132" => 1,"E9133" => 1,"E9138" => 1,"E9139" => 1,"E9530" => 1,"E9531" => 1,"E9538" => 1,"E9539" => 1,"E9630" => 1,"E9830" => 1,"E9831" => 1,"E9838" => 1,
                              "E9839" => 1);
    
    # Other specified classifiable
    my %hRow_abuse =         ("E9670" => 1,"E9671" => 1,"E9672" => 1,"E9673" => 1,"E9674" => 1,"E9675" => 1,"E9676" => 1,"E9677" => 1,"E9678" => 1,"E9679" => 1);
    
    my %hRow_noabuse =       ("E8460" => 1,"E8470" => 1,"E8480" => 1,"E9140" => 1,"E9150" => 1,"E9180" => 1,"E9210" => 1,"E9211" => 1,"E9218" => 1,"E9219" => 1,"E9225" => 1,"E9230" => 1,"E9231" => 1,"E9232" => 1,"E9238" => 1,"E9239" => 1,
                              "E9250" => 1,"E9251" => 1,"E9252" => 1,"E9258" => 1,"E9259" => 1,"E9260" => 1,"E9260" => 1,"E9261" => 1,"E9262" => 1,"E9263" => 1,"E9264" => 1,"E9265" => 1,"E9268" => 1,"E9269" => 1,"E9290" => 1,"E9291" => 1,
                              "E9292" => 1,"E9293" => 1,"E9294" => 1,"E9295" => 1,"E9555" => 1,"E9556" => 1,"E9557" => 1,"E9559" => 1,"E9580" => 1,"E9584" => 1,"E9601" => 1,"E9655" => 1,"E9656" => 1,"E9657" => 1,"E9658" => 1,"E9659" => 1,
                              "E9684" => 1,"E9686" => 1,"E9687" => 1,"E9710" => 1,"E9780" => 1,"E9790" => 1,"E9791" => 1,"E9792" => 1,"E9793" => 1,"E9794" => 1,"E9795" => 1,"E9796" => 1,"E9797" => 1,"E9798" => 1,"E9799" => 1,"E9855" => 1,
                              "E9856" => 1,"E9857" => 1,"E9880" => 1,"E9884" => 1,"E9900" => 1,"E9909" => 1,"E9910" => 1,"E9910" => 1,"E9911" => 1,"E9912" => 1,"E9913" => 1,"E9919" => 1,"E9920" => 1,"E9930" => 1,"E9940" => 1,"E9960" => 1,
                              "E9970" => 1,"E9971" => 1,"E9972" => 1);
    
    my %hRow_othernec =      ("E9270" => 1,"E9288" => 1,"E9298" => 1,"E9588" => 1,"E9590" => 1,"E9688" => 1,"E9690" => 1,"E9770" => 1,"E9888" => 1,"E9890" => 1,"E9950" => 1,"E9978" => 1,"E9980" => 1,"E9990" => 1,"E9991" => 1);
    
    my %hRow_unspec =        ("E8870" => 1,"E9289" => 1,"E9299" => 1,"E9589" => 1,"E9689" => 1,"E9760" => 1,"E9889" => 1,"E9979" => 1);
    
    
    # Codes to be removed
    my %hRow_poismed =       ("E8500" => 1,"E8501" => 1,"E8502" => 1,"E8503" => 1,"E8504" => 1,"E8505" => 1,"E8506" => 1,"E8507" => 1,"E8508" => 1,"E8509" => 1,"E8510" => 1,"E8520" => 1,"E8521" => 1,"E8522" => 1,"E8523" => 1,"E8524" => 1,
                              "E8525" => 1,"E8528" => 1,"E8529" => 1,"E8530" => 1,"E8530" => 1,"E8531" => 1,"E8532" => 1,"E8538" => 1,"E8539" => 1,"E8540" => 1,"E8540" => 1,"E8541" => 1,"E8542" => 1,"E8543" => 1,"E8548" => 1,"E8550" => 1,
                              "E8551" => 1,"E8552" => 1,"E8553" => 1,"E8554" => 1,"E8555" => 1,"E8556" => 1,"E8558" => 1,"E8559" => 1,"E8560" => 1,"E8570" => 1,"E8580" => 1,"E8581" => 1,"E8582" => 1,"E8583" => 1,"E8584" => 1,"E8585" => 1,
                              "E8586" => 1,"E8587" => 1,"E8588" => 1,"E8589" => 1,"E9500" => 1,"E9501" => 1,"E9502" => 1,"E9503" => 1,"E9504" => 1,"E9505" => 1,"E9800" => 1,"E9801" => 1,"E9802" => 1,"E9803" => 1,"E9804" => 1,"E9805" => 1);
    
    my %hRow_advmed =        ("E8700" => 1,"E8701" => 1,"E8702" => 1,"E8703" => 1,"E8704" => 1,"E8705" => 1,"E8706" => 1,"E8707" => 1,"E8708" => 1,"E8709" => 1,"E8710" => 1,"E8710" => 1,"E8711" => 1,"E8712" => 1,"E8713" => 1,"E8714" => 1,
                              "E8715" => 1,"E8716" => 1,"E8717" => 1,"E8718" => 1,"E8719" => 1,"E8720" => 1,"E8720" => 1,"E8721" => 1,"E8722" => 1,"E8723" => 1,"E8724" => 1,"E8725" => 1,"E8726" => 1,"E8728" => 1,"E8729" => 1,"E8730" => 1,
                              "E8730" => 1,"E8731" => 1,"E8732" => 1,"E8733" => 1,"E8734" => 1,"E8735" => 1,"E8736" => 1,"E8738" => 1,"E8739" => 1,"E8740" => 1,"E8740" => 1,"E8741" => 1,"E8742" => 1,"E8743" => 1,"E8744" => 1,"E8745" => 1,
                              "E8748" => 1,"E8749" => 1,"E8750" => 1,"E8750" => 1,"E8751" => 1,"E8752" => 1,"E8758" => 1,"E8759" => 1,"E8760" => 1,"E8760" => 1,"E8761" => 1,"E8762" => 1,"E8763" => 1,"E8764" => 1,"E8765" => 1,"E8768" => 1,
                              "E8769" => 1,"E8780" => 1,"E8781" => 1,"E8782" => 1,"E8783" => 1,"E8784" => 1,"E8785" => 1,"E8786" => 1,"E8788" => 1,"E8789" => 1,"E8790" => 1,"E8790" => 1,"E8791" => 1,"E8792" => 1,"E8793" => 1,"E8794" => 1,
                              "E8795" => 1,"E8796" => 1,"E8797" => 1,"E8798" => 1,"E8799" => 1,"E9300" => 1,"E9301" => 1,"E9302" => 1,"E9303" => 1,"E9304" => 1,"E9305" => 1,"E9306" => 1,"E9307" => 1,"E9308" => 1,"E9309" => 1,"E9310" => 1,
                              "E9310" => 1,"E9311" => 1,"E9312" => 1,"E9313" => 1,"E9314" => 1,"E9315" => 1,"E9316" => 1,"E9317" => 1,"E9318" => 1,"E9319" => 1,"E9320" => 1,"E9320" => 1,"E9321" => 1,"E9322" => 1,"E9323" => 1,"E9324" => 1,
                              "E9325" => 1,"E9326" => 1,"E9327" => 1,"E9328" => 1,"E9329" => 1,"E9330" => 1,"E9330" => 1,"E9331" => 1,"E9332" => 1,"E9333" => 1,"E9334" => 1,"E9335" => 1,"E9338" => 1,"E9339" => 1,"E9340" => 1,"E9340" => 1,
                              "E9341" => 1,"E9342" => 1,"E9343" => 1,"E9344" => 1,"E9345" => 1,"E9346" => 1,"E9347" => 1,"E9348" => 1,"E9349" => 1,"E9350" => 1,"E9350" => 1,"E9351" => 1,"E9352" => 1,"E9353" => 1,"E9354" => 1,"E9355" => 1,
                              "E9356" => 1,"E9357" => 1,"E9358" => 1,"E9359" => 1,"E9360" => 1,"E9360" => 1,"E9361" => 1,"E9362" => 1,"E9363" => 1,"E9364" => 1,"E9370" => 1,"E9371" => 1,"E9372" => 1,"E9373" => 1,"E9374" => 1,"E9375" => 1,
                              "E9376" => 1,"E9378" => 1,"E9379" => 1,"E9380" => 1,"E9380" => 1,"E9381" => 1,"E9382" => 1,"E9383" => 1,"E9384" => 1,"E9385" => 1,"E9386" => 1,"E9387" => 1,"E9389" => 1,"E9390" => 1,"E9390" => 1,"E9391" => 1,
                              "E9392" => 1,"E9393" => 1,"E9394" => 1,"E9395" => 1,"E9396" => 1,"E9397" => 1,"E9398" => 1,"E9399" => 1,"E9400" => 1,"E9400" => 1,"E9401" => 1,"E9408" => 1,"E9409" => 1,"E9410" => 1,"E9410" => 1,"E9411" => 1,
                              "E9412" => 1,"E9413" => 1,"E9419" => 1,"E9420" => 1,"E9420" => 1,"E9421" => 1,"E9422" => 1,"E9423" => 1,"E9424" => 1,"E9425" => 1,"E9426" => 1,"E9427" => 1,"E9428" => 1,"E9429" => 1,"E9430" => 1,"E9430" => 1,
                              "E9431" => 1,"E9432" => 1,"E9433" => 1,"E9434" => 1,"E9435" => 1,"E9436" => 1,"E9438" => 1,"E9439" => 1,"E9440" => 1,"E9440" => 1,"E9441" => 1,"E9442" => 1,"E9443" => 1,"E9444" => 1,"E9445" => 1,"E9446" => 1,
                              "E9447" => 1,"E9450" => 1,"E9451" => 1,"E9452" => 1,"E9453" => 1,"E9454" => 1,"E9455" => 1,"E9456" => 1,"E9457" => 1,"E9458" => 1,"E9460" => 1,"E9461" => 1,"E9462" => 1,"E9463" => 1,"E9464" => 1,"E9465" => 1,
                              "E9466" => 1,"E9467" => 1,"E9468" => 1,"E9469" => 1,"E9470" => 1,"E9470" => 1,"E9471" => 1,"E9472" => 1,"E9473" => 1,"E9474" => 1,"E9478" => 1,"E9479" => 1,"E9480" => 1,"E9480" => 1,"E9481" => 1,"E9482" => 1,
                              "E9483" => 1,"E9484" => 1,"E9485" => 1,"E9486" => 1,"E9488" => 1,"E9489" => 1,"E9490" => 1,"E9490" => 1,"E9491" => 1,"E9492" => 1,"E9493" => 1,"E9494" => 1,"E9495" => 1,"E9496" => 1,"E9497" => 1,"E9499" => 1);
    
    my %hRow_poisoning =     ("E8500" => 1,"E8501" => 1,"E8502" => 1,"E8503" => 1,"E8504" => 1,"E8505" => 1,"E8506" => 1,"E8507" => 1,"E8508" => 1,"E8509" => 1,"E8510" => 1,"E8520" => 1,"E8521" => 1,"E8522" => 1,"E8523" => 1,"E8524" => 1,
                              "E8525" => 1,"E8528" => 1,"E8529" => 1,"E8530" => 1,"E8530" => 1,"E8531" => 1,"E8532" => 1,"E8538" => 1,"E8539" => 1,"E8540" => 1,"E8540" => 1,"E8541" => 1,"E8542" => 1,"E8543" => 1,"E8548" => 1,"E8550" => 1,
                              "E8551" => 1,"E8552" => 1,"E8553" => 1,"E8554" => 1,"E8555" => 1,"E8556" => 1,"E8558" => 1,"E8559" => 1,"E8560" => 1,"E8570" => 1,"E8580" => 1,"E8581" => 1,"E8582" => 1,"E8583" => 1,"E8584" => 1,"E8585" => 1,
                              "E8586" => 1,"E8587" => 1,"E8588" => 1,"E8589" => 1,"E8600" => 1,"E8601" => 1,"E8602" => 1,"E8603" => 1,"E8604" => 1,"E8608" => 1,"E8609" => 1,"E8610" => 1,"E8610" => 1,"E8611" => 1,"E8612" => 1,"E8613" => 1,
                              "E8614" => 1,"E8615" => 1,"E8616" => 1,"E8619" => 1,"E8620" => 1,"E8620" => 1,"E8621" => 1,"E8622" => 1,"E8623" => 1,"E8624" => 1,"E8629" => 1,"E8630" => 1,"E8630" => 1,"E8631" => 1,"E8632" => 1,"E8633" => 1,
                              "E8634" => 1,"E8635" => 1,"E8636" => 1,"E8637" => 1,"E8638" => 1,"E8639" => 1,"E8640" => 1,"E8640" => 1,"E8641" => 1,"E8642" => 1,"E8643" => 1,"E8644" => 1,"E8650" => 1,"E8651" => 1,"E8652" => 1,"E8653" => 1,
                              "E8654" => 1,"E8655" => 1,"E8658" => 1,"E8659" => 1,"E8660" => 1,"E8660" => 1,"E8661" => 1,"E8662" => 1,"E8663" => 1,"E8664" => 1,"E8665" => 1,"E8666" => 1,"E8667" => 1,"E8668" => 1,"E8669" => 1,"E8670" => 1,
                              "E8680" => 1,"E8681" => 1,"E8682" => 1,"E8683" => 1,"E8688" => 1,"E8689" => 1,"E8690" => 1,"E8690" => 1,"E8691" => 1,"E8692" => 1,"E8693" => 1,"E8694" => 1,"E8698" => 1,"E8699" => 1,"E9500" => 1,"E9501" => 1,
                              "E9502" => 1,"E9503" => 1,"E9504" => 1,"E9505" => 1,"E9506" => 1,"E9507" => 1,"E9508" => 1,"E9509" => 1,"E9510" => 1,"E9510" => 1,"E9511" => 1,"E9518" => 1,"E9520" => 1,"E9521" => 1,"E9528" => 1,"E9529" => 1,
                              "E9620" => 1,"E9621" => 1,"E9622" => 1,"E9629" => 1,"E9720" => 1,"E9800" => 1,"E9801" => 1,"E9802" => 1,"E9803" => 1,"E9804" => 1,"E9805" => 1,"E9806" => 1,"E9807" => 1,"E9808" => 1,"E9809" => 1,"E9810" => 1,
                              "E9810" => 1,"E9811" => 1,"E9818" => 1,"E9820" => 1,"E9821" => 1,"E9828" => 1,"E9829" => 1);
    
    # Coding Cols
    my %hCol_assault =      ("E9600" => 1,"E9601" => 1,"E9610" => 1,"E9620" => 1,"E9621" => 1,"E9622" => 1,"E9629" => 1,"E9630" => 1,"E9640" => 1,"E9650" => 1,"E9651" => 1,"E9652" => 1,"E9653" => 1,"E9654" => 1,"E9655" => 1,"E9656" => 1,
                             "E9657" => 1,"E9658" => 1,"E9659" => 1,"E9660" => 1,"E9670" => 1,"E9671" => 1,"E9672" => 1,"E9673" => 1,"E9674" => 1,"E9675" => 1,"E9676" => 1,"E9677" => 1,"E9678" => 1,"E9679" => 1,"E9680" => 1,"E9681" => 1,
                             "E9682" => 1,"E9683" => 1,"E9684" => 1,"E9685" => 1,"E9686" => 1,"E9687" => 1,"E9688" => 1,"E9689" => 1,"E9690" => 1,"E9790" => 1,"E9791" => 1,"E9792" => 1,"E9793" => 1,"E9794" => 1,"E9795" => 1,"E9796" => 1,
                             "E9797" => 1,"E9798" => 1,"E9799" => 1,"E9600" => 1,"E9630" => 1,"E9650" => 1,"E9660" => 1,"E9680" => 1,"E9640" => 1);
    
    my %hCol_other =        ("E8700" => 1,"E8701" => 1,"E8702" => 1,"E8703" => 1,"E8704" => 1,"E8705" => 1,"E8706" => 1,"E8707" => 1,"E8708" => 1,"E8709" => 1,"E8710" => 1,"E8710" => 1,"E8711" => 1,"E8712" => 1,"E8713" => 1,"E8714" => 1,
                             "E8715" => 1,"E8716" => 1,"E8717" => 1,"E8718" => 1,"E8719" => 1,"E8720" => 1,"E8720" => 1,"E8721" => 1,"E8722" => 1,"E8723" => 1,"E8724" => 1,"E8725" => 1,"E8726" => 1,"E8728" => 1,"E8729" => 1,"E8730" => 1,
                             "E8730" => 1,"E8731" => 1,"E8732" => 1,"E8733" => 1,"E8734" => 1,"E8735" => 1,"E8736" => 1,"E8738" => 1,"E8739" => 1,"E8740" => 1,"E8740" => 1,"E8741" => 1,"E8742" => 1,"E8743" => 1,"E8744" => 1,"E8745" => 1,
                             "E8748" => 1,"E8749" => 1,"E8750" => 1,"E8750" => 1,"E8751" => 1,"E8752" => 1,"E8758" => 1,"E8759" => 1,"E8760" => 1,"E8760" => 1,"E8761" => 1,"E8762" => 1,"E8763" => 1,"E8764" => 1,"E8765" => 1,"E8768" => 1,
                             "E8769" => 1,"E8780" => 1,"E8781" => 1,"E8782" => 1,"E8783" => 1,"E8784" => 1,"E8785" => 1,"E8786" => 1,"E8788" => 1,"E8789" => 1,"E8790" => 1,"E8790" => 1,"E8791" => 1,"E8792" => 1,"E8793" => 1,"E8794" => 1,
                             "E8795" => 1,"E8796" => 1,"E8797" => 1,"E8798" => 1,"E8799" => 1,"E9300" => 1,"E9301" => 1,"E9302" => 1,"E9303" => 1,"E9304" => 1,"E9305" => 1,"E9306" => 1,"E9307" => 1,"E9308" => 1,"E9309" => 1,"E9310" => 1,
                             "E9310" => 1,"E9311" => 1,"E9312" => 1,"E9313" => 1,"E9314" => 1,"E9315" => 1,"E9316" => 1,"E9317" => 1,"E9318" => 1,"E9319" => 1,"E9320" => 1,"E9320" => 1,"E9321" => 1,"E9322" => 1,"E9323" => 1,"E9324" => 1,
                             "E9325" => 1,"E9326" => 1,"E9327" => 1,"E9328" => 1,"E9329" => 1,"E9330" => 1,"E9330" => 1,"E9331" => 1,"E9332" => 1,"E9333" => 1,"E9334" => 1,"E9335" => 1,"E9338" => 1,"E9339" => 1,"E9340" => 1,"E9340" => 1,
                             "E9341" => 1,"E9342" => 1,"E9343" => 1,"E9344" => 1,"E9345" => 1,"E9346" => 1,"E9347" => 1,"E9348" => 1,"E9349" => 1,"E9350" => 1,"E9350" => 1,"E9351" => 1,"E9352" => 1,"E9353" => 1,"E9354" => 1,"E9355" => 1,
                             "E9356" => 1,"E9357" => 1,"E9358" => 1,"E9359" => 1,"E9360" => 1,"E9360" => 1,"E9361" => 1,"E9362" => 1,"E9363" => 1,"E9364" => 1,"E9370" => 1,"E9371" => 1,"E9372" => 1,"E9373" => 1,"E9374" => 1,"E9375" => 1,
                             "E9376" => 1,"E9378" => 1,"E9379" => 1,"E9380" => 1,"E9380" => 1,"E9381" => 1,"E9382" => 1,"E9383" => 1,"E9384" => 1,"E9385" => 1,"E9386" => 1,"E9387" => 1,"E9389" => 1,"E9390" => 1,"E9390" => 1,"E9391" => 1,
                             "E9392" => 1,"E9393" => 1,"E9394" => 1,"E9395" => 1,"E9396" => 1,"E9397" => 1,"E9398" => 1,"E9399" => 1,"E9400" => 1,"E9400" => 1,"E9401" => 1,"E9408" => 1,"E9409" => 1,"E9410" => 1,"E9410" => 1,"E9411" => 1,
                             "E9412" => 1,"E9413" => 1,"E9419" => 1,"E9420" => 1,"E9420" => 1,"E9421" => 1,"E9422" => 1,"E9423" => 1,"E9424" => 1,"E9425" => 1,"E9426" => 1,"E9427" => 1,"E9428" => 1,"E9429" => 1,"E9430" => 1,"E9430" => 1,
                             "E9431" => 1,"E9432" => 1,"E9433" => 1,"E9434" => 1,"E9435" => 1,"E9436" => 1,"E9438" => 1,"E9439" => 1,"E9440" => 1,"E9440" => 1,"E9441" => 1,"E9442" => 1,"E9443" => 1,"E9444" => 1,"E9445" => 1,"E9446" => 1,
                             "E9447" => 1,"E9450" => 1,"E9451" => 1,"E9452" => 1,"E9453" => 1,"E9454" => 1,"E9455" => 1,"E9456" => 1,"E9457" => 1,"E9458" => 1,"E9460" => 1,"E9461" => 1,"E9462" => 1,"E9463" => 1,"E9464" => 1,"E9465" => 1,
                             "E9466" => 1,"E9467" => 1,"E9468" => 1,"E9469" => 1,"E9470" => 1,"E9470" => 1,"E9471" => 1,"E9472" => 1,"E9473" => 1,"E9474" => 1,"E9478" => 1,"E9479" => 1,"E9480" => 1,"E9480" => 1,"E9481" => 1,"E9482" => 1,
                             "E9483" => 1,"E9484" => 1,"E9485" => 1,"E9486" => 1,"E9488" => 1,"E9489" => 1,"E9490" => 1,"E9490" => 1,"E9491" => 1,"E9492" => 1,"E9493" => 1,"E9494" => 1,"E9495" => 1,"E9496" => 1,"E9497" => 1,"E9499" => 1,
                             "E9700" => 1,"E9710" => 1,"E9720" => 1,"E9730" => 1,"E9740" => 1,"E9750" => 1,"E9760" => 1,"E9770" => 1,"E9780" => 1,"E9900" => 1,"E9909" => 1,"E9910" => 1,"E9910" => 1,"E9911" => 1,"E9912" => 1,"E9913" => 1,
                             "E9919" => 1,"E9920" => 1,"E9930" => 1,"E9940" => 1,"E9950" => 1,"E9960" => 1,"E9970" => 1,"E9971" => 1,"E9972" => 1,"E9978" => 1,"E9979" => 1,"E9980" => 1,"E9990" => 1,"E9700" => 1,"E9730" => 1,"E9740" => 1,
                             "E9750" => 1,"E9760" => 1,"E9780" => 1);
    
    my %hCol_selfInfl =     ("E9500" => 1,"E9501" => 1,"E9502" => 1,"E9503" => 1,"E9504" => 1,"E9505" => 1,"E9506" => 1,"E9507" => 1,"E9508" => 1,"E9509" => 1,"E9510" => 1,"E9510" => 1,"E9511" => 1,"E9518" => 1,"E9520" => 1,"E9521" => 1,
                             "E9528" => 1,"E9529" => 1,"E9530" => 1,"E9531" => 1,"E9538" => 1,"E9539" => 1,"E9550" => 1,"E9551" => 1,"E9552" => 1,"E9553" => 1,"E9554" => 1,"E9555" => 1,"E9556" => 1,"E9557" => 1,"E9559" => 1,"E9570" => 1,
                             "E9571" => 1,"E9572" => 1,"E9579" => 1,"E9580" => 1,"E9581" => 1,"E9582" => 1,"E9583" => 1,"E9584" => 1,"E9585" => 1,"E9586" => 1,"E9587" => 1,"E9588" => 1,"E9589" => 1,"E9590" => 1,"E9540" => 1,"E9560" => 1,
                             "E9560" => 1,"E9580" => 1,"E9570" => 1,"E9550" => 1);
    
    my %hCol_undet =        ("E9800" => 1,"E9801" => 1,"E9802" => 1,"E9803" => 1,"E9804" => 1,"E9805" => 1,"E9806" => 1,"E9807" => 1,"E9808" => 1,"E9809" => 1,"E9810" => 1,"E9810" => 1,"E9811" => 1,"E9818" => 1,"E9820" => 1,"E9821" => 1,
                             "E9828" => 1,"E9829" => 1,"E9830" => 1,"E9831" => 1,"E9838" => 1,"E9839" => 1,"E9840" => 1,"E9850" => 1,"E9851" => 1,"E9852" => 1,"E9853" => 1,"E9854" => 1,"E9855" => 1,"E9856" => 1,"E9857" => 1,"E9860" => 1,
                             "E9870" => 1,"E9871" => 1,"E9872" => 1,"E9879" => 1,"E9880" => 1,"E9881" => 1,"E9882" => 1,"E9883" => 1,"E9884" => 1,"E9885" => 1,"E9886" => 1,"E9887" => 1,"E9888" => 1,"E9889" => 1,"E9890" => 1,"E9860" => 1,
                             "E9880" => 1,"E9840" => 1);
    
    my %hCol_uninten =      ("E8000" => 1,"E8001" => 1,"E8002" => 1,"E8003" => 1,"E8008" => 1,"E8009" => 1,"E8010" => 1,"E8010" => 1,"E8011" => 1,"E8012" => 1,"E8013" => 1,"E8018" => 1,"E8019" => 1,"E8020" => 1,"E8020" => 1,"E8021" => 1,
                             "E8022" => 1,"E8023" => 1,"E8028" => 1,"E8029" => 1,"E8030" => 1,"E8030" => 1,"E8031" => 1,"E8032" => 1,"E8033" => 1,"E8038" => 1,"E8039" => 1,"E8040" => 1,"E8040" => 1,"E8041" => 1,"E8042" => 1,"E8043" => 1,
                             "E8048" => 1,"E8049" => 1,"E8050" => 1,"E8050" => 1,"E8051" => 1,"E8052" => 1,"E8053" => 1,"E8058" => 1,"E8059" => 1,"E8060" => 1,"E8060" => 1,"E8061" => 1,"E8062" => 1,"E8063" => 1,"E8068" => 1,"E8069" => 1,
                             "E8070" => 1,"E8070" => 1,"E8071" => 1,"E8072" => 1,"E8073" => 1,"E8078" => 1,"E8079" => 1,"E8100" => 1,"E8101" => 1,"E8102" => 1,"E8103" => 1,"E8104" => 1,"E8105" => 1,"E8106" => 1,"E8107" => 1,"E8108" => 1,
                             "E8109" => 1,"E8110" => 1,"E8110" => 1,"E8111" => 1,"E8112" => 1,"E8113" => 1,"E8114" => 1,"E8115" => 1,"E8116" => 1,"E8117" => 1,"E8118" => 1,"E8119" => 1,"E8120" => 1,"E8120" => 1,"E8121" => 1,"E8122" => 1,
                             "E8123" => 1,"E8124" => 1,"E8125" => 1,"E8126" => 1,"E8127" => 1,"E8128" => 1,"E8129" => 1,"E8130" => 1,"E8130" => 1,"E8131" => 1,"E8132" => 1,"E8133" => 1,"E8134" => 1,"E8135" => 1,"E8136" => 1,"E8137" => 1,
                             "E8138" => 1,"E8139" => 1,"E8140" => 1,"E8140" => 1,"E8141" => 1,"E8142" => 1,"E8143" => 1,"E8144" => 1,"E8145" => 1,"E8146" => 1,"E8147" => 1,"E8148" => 1,"E8149" => 1,"E8150" => 1,"E8150" => 1,"E8151" => 1,
                             "E8152" => 1,"E8153" => 1,"E8154" => 1,"E8155" => 1,"E8156" => 1,"E8157" => 1,"E8158" => 1,"E8159" => 1,"E8160" => 1,"E8160" => 1,"E8161" => 1,"E8162" => 1,"E8163" => 1,"E8164" => 1,"E8165" => 1,"E8166" => 1,
                             "E8167" => 1,"E8168" => 1,"E8169" => 1,"E8170" => 1,"E8170" => 1,"E8171" => 1,"E8172" => 1,"E8173" => 1,"E8174" => 1,"E8175" => 1,"E8176" => 1,"E8177" => 1,"E8178" => 1,"E8179" => 1,"E8180" => 1,"E8180" => 1,
                             "E8181" => 1,"E8182" => 1,"E8183" => 1,"E8184" => 1,"E8185" => 1,"E8186" => 1,"E8187" => 1,"E8188" => 1,"E8189" => 1,"E8190" => 1,"E8190" => 1,"E8191" => 1,"E8192" => 1,"E8193" => 1,"E8194" => 1,"E8195" => 1,
                             "E8196" => 1,"E8197" => 1,"E8198" => 1,"E8199" => 1,"E8200" => 1,"E8201" => 1,"E8202" => 1,"E8203" => 1,"E8204" => 1,"E8205" => 1,"E8206" => 1,"E8207" => 1,"E8208" => 1,"E8209" => 1,"E8210" => 1,"E8210" => 1,
                             "E8211" => 1,"E8212" => 1,"E8213" => 1,"E8214" => 1,"E8215" => 1,"E8216" => 1,"E8217" => 1,"E8218" => 1,"E8219" => 1,"E8220" => 1,"E8220" => 1,"E8221" => 1,"E8222" => 1,"E8223" => 1,"E8224" => 1,"E8225" => 1,
                             "E8226" => 1,"E8227" => 1,"E8228" => 1,"E8229" => 1,"E8230" => 1,"E8230" => 1,"E8231" => 1,"E8232" => 1,"E8233" => 1,"E8234" => 1,"E8235" => 1,"E8236" => 1,"E8237" => 1,"E8238" => 1,"E8239" => 1,"E8240" => 1,
                             "E8240" => 1,"E8241" => 1,"E8242" => 1,"E8243" => 1,"E8244" => 1,"E8245" => 1,"E8246" => 1,"E8247" => 1,"E8248" => 1,"E8249" => 1,"E8250" => 1,"E8250" => 1,"E8251" => 1,"E8252" => 1,"E8253" => 1,"E8254" => 1,
                             "E8255" => 1,"E8256" => 1,"E8257" => 1,"E8258" => 1,"E8259" => 1,"E8260" => 1,"E8261" => 1,"E8262" => 1,"E8263" => 1,"E8264" => 1,"E8268" => 1,"E8269" => 1,"E8270" => 1,"E8272" => 1,"E8273" => 1,"E8274" => 1,
                             "E8278" => 1,"E8279" => 1,"E8280" => 1,"E8282" => 1,"E8284" => 1,"E8288" => 1,"E8289" => 1,"E8290" => 1,"E8294" => 1,"E8298" => 1,"E8299" => 1,"E8300" => 1,"E8301" => 1,"E8302" => 1,"E8303" => 1,"E8304" => 1,
                             "E8305" => 1,"E8306" => 1,"E8308" => 1,"E8309" => 1,"E8310" => 1,"E8311" => 1,"E8312" => 1,"E8313" => 1,"E8314" => 1,"E8315" => 1,"E8316" => 1,"E8318" => 1,"E8319" => 1,"E8320" => 1,"E8321" => 1,"E8322" => 1,
                             "E8323" => 1,"E8324" => 1,"E8325" => 1,"E8326" => 1,"E8328" => 1,"E8329" => 1,"E8330" => 1,"E8331" => 1,"E8332" => 1,"E8333" => 1,"E8334" => 1,"E8335" => 1,"E8336" => 1,"E8338" => 1,"E8339" => 1,"E8340" => 1,
                             "E8340" => 1,"E8341" => 1,"E8342" => 1,"E8343" => 1,"E8344" => 1,"E8345" => 1,"E8346" => 1,"E8348" => 1,"E8349" => 1,"E8350" => 1,"E8350" => 1,"E8351" => 1,"E8352" => 1,"E8353" => 1,"E8354" => 1,"E8355" => 1,
                             "E8356" => 1,"E8358" => 1,"E8359" => 1,"E8360" => 1,"E8360" => 1,"E8361" => 1,"E8362" => 1,"E8363" => 1,"E8364" => 1,"E8365" => 1,"E8366" => 1,"E8368" => 1,"E8369" => 1,"E8370" => 1,"E8370" => 1,"E8371" => 1,
                             "E8372" => 1,"E8373" => 1,"E8374" => 1,"E8375" => 1,"E8376" => 1,"E8378" => 1,"E8379" => 1,"E8380" => 1,"E8380" => 1,"E8381" => 1,"E8382" => 1,"E8383" => 1,"E8384" => 1,"E8385" => 1,"E8386" => 1,"E8388" => 1,
                             "E8389" => 1,"E8400" => 1,"E8401" => 1,"E8402" => 1,"E8403" => 1,"E8404" => 1,"E8405" => 1,"E8406" => 1,"E8407" => 1,"E8408" => 1,"E8409" => 1,"E8410" => 1,"E8410" => 1,"E8411" => 1,"E8412" => 1,"E8413" => 1,
                             "E8414" => 1,"E8415" => 1,"E8416" => 1,"E8417" => 1,"E8418" => 1,"E8419" => 1,"E8426" => 1,"E8427" => 1,"E8428" => 1,"E8429" => 1,"E8430" => 1,"E8430" => 1,"E8431" => 1,"E8432" => 1,"E8433" => 1,"E8434" => 1,
                             "E8435" => 1,"E8436" => 1,"E8437" => 1,"E8438" => 1,"E8439" => 1,"E8440" => 1,"E8440" => 1,"E8441" => 1,"E8442" => 1,"E8443" => 1,"E8444" => 1,"E8445" => 1,"E8446" => 1,"E8447" => 1,"E8448" => 1,"E8449" => 1,
                             "E8450" => 1,"E8450" => 1,"E8458" => 1,"E8459" => 1,"E8460" => 1,"E8470" => 1,"E8480" => 1,"E8500" => 1,"E8501" => 1,"E8502" => 1,"E8503" => 1,"E8504" => 1,"E8505" => 1,"E8506" => 1,"E8507" => 1,"E8508" => 1,
                             "E8509" => 1,"E8510" => 1,"E8520" => 1,"E8521" => 1,"E8522" => 1,"E8523" => 1,"E8524" => 1,"E8525" => 1,"E8528" => 1,"E8529" => 1,"E8530" => 1,"E8530" => 1,"E8531" => 1,"E8532" => 1,"E8538" => 1,"E8539" => 1,
                             "E8540" => 1,"E8540" => 1,"E8541" => 1,"E8542" => 1,"E8543" => 1,"E8548" => 1,"E8550" => 1,"E8551" => 1,"E8552" => 1,"E8553" => 1,"E8554" => 1,"E8555" => 1,"E8556" => 1,"E8558" => 1,"E8559" => 1,"E8560" => 1,
                             "E8570" => 1,"E8580" => 1,"E8581" => 1,"E8582" => 1,"E8583" => 1,"E8584" => 1,"E8585" => 1,"E8586" => 1,"E8587" => 1,"E8588" => 1,"E8589" => 1,"E8600" => 1,"E8601" => 1,"E8602" => 1,"E8603" => 1,"E8604" => 1,
                             "E8608" => 1,"E8609" => 1,"E8610" => 1,"E8610" => 1,"E8611" => 1,"E8612" => 1,"E8613" => 1,"E8614" => 1,"E8615" => 1,"E8616" => 1,"E8619" => 1,"E8620" => 1,"E8620" => 1,"E8621" => 1,"E8622" => 1,"E8623" => 1,
                             "E8624" => 1,"E8629" => 1,"E8630" => 1,"E8630" => 1,"E8631" => 1,"E8632" => 1,"E8633" => 1,"E8634" => 1,"E8635" => 1,"E8636" => 1,"E8637" => 1,"E8638" => 1,"E8639" => 1,"E8640" => 1,"E8640" => 1,"E8641" => 1,
                             "E8642" => 1,"E8643" => 1,"E8644" => 1,"E8650" => 1,"E8651" => 1,"E8652" => 1,"E8653" => 1,"E8654" => 1,"E8655" => 1,"E8658" => 1,"E8659" => 1,"E8660" => 1,"E8660" => 1,"E8661" => 1,"E8662" => 1,"E8663" => 1,
                             "E8664" => 1,"E8665" => 1,"E8666" => 1,"E8667" => 1,"E8668" => 1,"E8669" => 1,"E8670" => 1,"E8680" => 1,"E8681" => 1,"E8682" => 1,"E8683" => 1,"E8688" => 1,"E8689" => 1,"E8690" => 1,"E8690" => 1,"E8691" => 1,
                             "E8692" => 1,"E8693" => 1,"E8694" => 1,"E8698" => 1,"E8699" => 1,"E8800" => 1,"E8801" => 1,"E8809" => 1,"E8810" => 1,"E8810" => 1,"E8811" => 1,"E8820" => 1,"E8830" => 1,"E8831" => 1,"E8832" => 1,"E8839" => 1,
                             "E8840" => 1,"E8840" => 1,"E8841" => 1,"E8842" => 1,"E8843" => 1,"E8844" => 1,"E8845" => 1,"E8846" => 1,"E8849" => 1,"E8850" => 1,"E8850" => 1,"E8851" => 1,"E8852" => 1,"E8853" => 1,"E8854" => 1,"E8859" => 1,
                             "E8860" => 1,"E8869" => 1,"E8870" => 1,"E8880" => 1,"E8880" => 1,"E8881" => 1,"E8888" => 1,"E8889" => 1,"E8900" => 1,"E8901" => 1,"E8902" => 1,"E8903" => 1,"E8908" => 1,"E8909" => 1,"E8910" => 1,"E8910" => 1,
                             "E8911" => 1,"E8912" => 1,"E8913" => 1,"E8918" => 1,"E8919" => 1,"E8920" => 1,"E8930" => 1,"E8931" => 1,"E8932" => 1,"E8938" => 1,"E8939" => 1,"E8940" => 1,"E8950" => 1,"E8960" => 1,"E8970" => 1,"E8980" => 1,
                             "E8981" => 1,"E8990" => 1,"E9000" => 1,"E9001" => 1,"E9009" => 1,"E9010" => 1,"E9010" => 1,"E9011" => 1,"E9018" => 1,"E9019" => 1,"E9020" => 1,"E9020" => 1,"E9021" => 1,"E9022" => 1,"E9028" => 1,"E9029" => 1,
                             "E9030" => 1,"E9040" => 1,"E9041" => 1,"E9042" => 1,"E9043" => 1,"E9049" => 1,"E9050" => 1,"E9050" => 1,"E9051" => 1,"E9052" => 1,"E9053" => 1,"E9054" => 1,"E9055" => 1,"E9056" => 1,"E9057" => 1,"E9058" => 1,
                             "E9059" => 1,"E9060" => 1,"E9060" => 1,"E9061" => 1,"E9062" => 1,"E9063" => 1,"E9064" => 1,"E9065" => 1,"E9068" => 1,"E9069" => 1,"E9070" => 1,"E9080" => 1,"E9080" => 1,"E9081" => 1,"E9082" => 1,"E9083" => 1,
                             "E9084" => 1,"E9088" => 1,"E9089" => 1,"E9090" => 1,"E9090" => 1,"E9091" => 1,"E9092" => 1,"E9093" => 1,"E9094" => 1,"E9098" => 1,"E9099" => 1,"E9100" => 1,"E9101" => 1,"E9102" => 1,"E9103" => 1,"E9104" => 1,
                             "E9108" => 1,"E9109" => 1,"E9110" => 1,"E9120" => 1,"E9130" => 1,"E9131" => 1,"E9132" => 1,"E9133" => 1,"E9138" => 1,"E9139" => 1,"E9140" => 1,"E9150" => 1,"E9160" => 1,"E9170" => 1,"E9171" => 1,"E9172" => 1,
                             "E9173" => 1,"E9174" => 1,"E9175" => 1,"E9176" => 1,"E9177" => 1,"E9178" => 1,"E9179" => 1,"E9180" => 1,"E9190" => 1,"E9191" => 1,"E9192" => 1,"E9193" => 1,"E9194" => 1,"E9195" => 1,"E9196" => 1,"E9197" => 1,
                             "E9198" => 1,"E9199" => 1,"E9200" => 1,"E9201" => 1,"E9202" => 1,"E9203" => 1,"E9204" => 1,"E9205" => 1,"E9208" => 1,"E9209" => 1,"E9210" => 1,"E9211" => 1,"E9218" => 1,"E9219" => 1,"E9220" => 1,"E9221" => 1,
                             "E9222" => 1,"E9223" => 1,"E9224" => 1,"E9225" => 1,"E9228" => 1,"E9229" => 1,"E9230" => 1,"E9231" => 1,"E9232" => 1,"E9238" => 1,"E9239" => 1,"E9240" => 1,"E9241" => 1,"E9242" => 1,"E9248" => 1,"E9249" => 1,
                             "E9250" => 1,"E9251" => 1,"E9252" => 1,"E9258" => 1,"E9259" => 1,"E9260" => 1,"E9260" => 1,"E9261" => 1,"E9262" => 1,"E9263" => 1,"E9264" => 1,"E9265" => 1,"E9268" => 1,"E9269" => 1,"E9270" => 1,"E9280" => 1,
                             "E9281" => 1,"E9282" => 1,"E9283" => 1,"E9288" => 1,"E9289" => 1,"E9290" => 1,"E9291" => 1,"E9292" => 1,"E9293" => 1,"E9294" => 1,"E9295" => 1,"E9298" => 1,"E9299" => 1,"E9991" => 1,"E8200" => 1,"E8280" => 1,
                             "E8290" => 1,"E8420" => 1,"E8460" => 1,"E8470" => 1,"E8480" => 1,"E8550" => 1,"E8650" => 1,"E8800" => 1,"E8820" => 1,"E8830" => 1,"E8860" => 1,"E8870" => 1,"E8920" => 1,"E8940" => 1,"E8950" => 1,"E8960" => 1,
                             "E8970" => 1,"E8990" => 1,"E9070" => 1,"E9110" => 1,"E9020" => 1,"E8940" => 1,"E9120" => 1,"E9130" => 1,"E9140" => 1,"E9150" => 1,"E9160" => 1,"E9170" => 1,"E9180" => 1,"E9190" => 1,"E9200" => 1,"E9270" => 1,
                             "E9230" => 1,"E8560" => 1);

#subroutines to trim whitespaces in a string variable
sub trim
{
    my($str) = shift;
   
    $str =~ m!^\s*(.+?)\s*$!i;
    defined $str ? return $str : return '';
}

sub trimIfEmpty
{
    my($str) = shift;
    if(!defined($str))
    {
        $str = "NULL";
    }
    else
    {
        $str = trim($str);
    }
    return $str;
}

sub exist2Codes
{
    my $hashRef1 = shift;
    my $code1 = shift;
    my $hashRef2 = shift;
    my $code2 = shift;
    my $retCode = 0;

    my %codeH1 = %$hashRef1;
    my %codeH2 = %$hashRef2;

    foreach my $id (keys %codeH1)
    {
        if (exists($codeH1{$id}{$code1}) && exists($codeH2{$id}{$code2}))
        {
            return 1;
        }
    }
    return 0;
}

sub isElement
{
    my $elem = shift;
    my @arr = @_;
    foreach (@_)
    {
        if($elem eq $_)
        {
            return 1;
        }
    }
    return 0;
}

sub filterICD9
{
    # filtering done by keeping burn patients
    my($icd9) = shift;
    my @array = split(//, $icd9);
    if($array[0] eq "V")
    {
        $icd9 = "REMOVEPATIENT";
    }
    else
    {
        if($icd9 < 800 or $icd9 > 959.9 and $icd9 != 995.5)
        {
            if($icd9 < 995.80 or $icd9 > 995.85)
            {
                $icd9 = "REMOVEPATIENT";
            }
        }
        else
        {
            if($icd9 >= 905 and $icd9 <= 909)
            {
                $icd9 = "REMOVEPATIENT";
            }
        }
    }
    return $icd9;
}

sub filterECODE
{
    my $ecode = shift;
    my ($ecodeRow, $ecodeCol);
    $ecode =~ s/\.//g;
    $ecode = sprintf "E" . $ecode;
    if(length($ecode) < 5)
    {
        $ecode = sprintf $ecode . "0";
    }
    
    #TODO: check for the size of $ecode: it should be 5
    
    # Coding rows
    my $cut = "Cut/Pierce";
    my $drown = "Drowning/Submersion";
    
    # Fall
    my $fallBldg = "Fall from Building";
    my $fallFurn = "Fall from Furniture";
    my $fallHgt = "Fall from Height";
    my $fallOther = "Fall Other";	
    my $fallPlay = "Fall during Play";
    my $fallSame = "Fall from Same Height";
    my $fallStair = "Fall from Stairs";

    my $burn = "Fire/Burn";
    my $firearm = "Firearm";
    
    # Machinery
    my $machAgri = "Agricultural Machinery";
    my $machOther = "Other Machinery";
    
    # Motor Vehicle traffic
    my $MVTAnimal = "MV Animal";
    my $MVTBike = "MV Bike";
    my $MVTMotor = "MV Motor";
    my $MVTOcc = "MV Occupant";
    my $MVTOther = "MV Other";
    my $MVTPed = "MV Pedestrian";
    my $MVTUnspec = "MV Unspecified";
    
    my $biknotmvt = "Pedal cyclist, other";
    my $pednotmvt = "Pedestrian, other";
    
    # Transport
    my $atv = "ATV Transport";
    my $noatv = "Non-ATV Transport";
    
    my $natural = "Natural/Environmental";
    my $overexert = "Overexertion";
    my $poisoning = "Poisoning";
    
    # Struck
    my $struckFell = "Struck and Fell";
    my $struckSport = "Struck in Sports";
    my $struckOther = "Struck Other";
    
    my $suffoc = "Suffocation";
    
    # Other specified classifiable
    my $abuse = "Abuse";
    my $noabuse = "Non-Abuse";
    
    my $othernec = "Other specified, not elsewhere classifiable";
    my $unspec = "Unspecified";
    
    my $col_assault = "Assault";
    my $col_other = "Other";
    my $col_selfInfl = "Self Inflicted";
    my $col_undet = "Undetermined";
    my $col_uninten = "Unintentional";
    
    if(exists($hRow_cut{$ecode}))
    {
        $ecodeRow = $cut;
    }
    elsif(exists($hRow_drown{$ecode}))
    {
        $ecodeRow = $drown;
    }
    elsif(exists($hRow_fallBldg{$ecode}))
    {
        $ecodeRow = $fallBldg;
    }
    elsif(exists($hRow_fallFurn{$ecode}))
    {
        $ecodeRow = $fallFurn;
    }
    elsif(exists($hRow_fallHgt{$ecode}))
    {
        $ecodeRow = $fallHgt;
    }
    elsif(exists($hRow_fallOther{$ecode}))
    {
        $ecodeRow = $fallOther;
    }
    elsif(exists($hRow_fallPlay{$ecode}))
    {
        $ecodeRow = $fallPlay;
    }
    elsif(exists($hRow_fallSame{$ecode}))
    {
        $ecodeRow = $fallSame;
    }
    elsif(exists($hRow_fallStair{$ecode}))
    {
        $ecodeRow = $fallStair;
    }
    elsif(exists($hRow_burn{$ecode}))
    {
        $ecodeRow = $burn;
    }
    elsif(exists($hRow_firearm{$ecode}))
    {
        $ecodeRow = $firearm;
    }
    elsif(exists($hRow_machAgri{$ecode}))
    {
        $ecodeRow = $machAgri;
    }
    elsif(exists($hRow_machOther{$ecode}))
    {
        $ecodeRow = $machOther;
    }
    elsif(exists($hRow_MVTAnimal{$ecode}))
    {
        $ecodeRow = $MVTAnimal;
    }
    elsif(exists($hRow_MVTBike{$ecode}))
    {
        $ecodeRow = $MVTBike;
    }
    elsif(exists($hRow_MVTMotor{$ecode}))
    {
        $ecodeRow = $MVTMotor;
    }
    elsif(exists($hRow_MVTOcc{$ecode}))
    {
        $ecodeRow = $MVTOcc;
    }
    elsif(exists($hRow_MVTOther{$ecode}))
    {
        $ecodeRow = $MVTOther;
    }
    elsif(exists($hRow_MVTPed{$ecode}))
    {
        $ecodeRow = $MVTPed;
    }
    elsif(exists($hRow_MVTUnspec{$ecode}))
    {
        $ecodeRow = $MVTUnspec;
    }
    elsif(exists($hRow_biknotmvt{$ecode}))
    {
        $ecodeRow = $biknotmvt;
    }
    elsif(exists($hRow_pednotmvt{$ecode}))
    {
        $ecodeRow = $pednotmvt;
    }
    elsif(exists($hRow_atv{$ecode}))
    {
        $ecodeRow = $atv;
    }
    elsif(exists($hRow_noatv{$ecode}))
    {
        $ecodeRow = $noatv;
    }
    elsif(exists($hRow_natural{$ecode}))
    {
        $ecodeRow = $natural;
    }
    elsif(exists($hRow_overexert{$ecode}))
    {
        $ecodeRow = $overexert;
    }
    elsif(exists($hRow_poisoning{$ecode}))
    {
        $ecodeRow = $poisoning;
    }
    elsif(exists($hRow_struckFell{$ecode}))
    {
        $ecodeRow = $struckFell;
    }
    elsif(exists($hRow_struckSport{$ecode}))
    {
        $ecodeRow = $struckSport;
    }
    elsif(exists($hRow_struckOther{$ecode}))
    {
        $ecodeRow = $struckOther;
    }
    elsif(exists($hRow_suffoc{$ecode}))
    {
        $ecodeRow = $suffoc;
    }
    elsif(exists($hRow_abuse{$ecode}))
    {
        $ecodeRow = $abuse;
    }
    elsif(exists($hRow_noabuse{$ecode}))
    {
        $ecodeRow = $noabuse;
    }
    elsif(exists($hRow_othernec{$ecode}))
    {
        $ecodeRow = $othernec;
    }
    elsif(exists($hRow_unspec{$ecode}))
    {
        $ecodeRow = $unspec;
    }
    else
    {
#        print "$ecode: ECODE ROW NOT FOUND!\n";
        $ecodeRow = "ECODENOTFOUND";
    }
    
    if(exists($hCol_assault{$ecode}))
    {
        $ecodeCol = $col_assault;
    }
    elsif(exists($hCol_other{$ecode}))
    {
        $ecodeCol = $col_other;
    }
    elsif(exists($hCol_selfInfl{$ecode}))
    {
        $ecodeCol = $col_selfInfl;
    }
    elsif(exists($hCol_undet{$ecode}))
    {
        $ecodeCol = $col_undet;
    }
    elsif(exists($hCol_uninten{$ecode}))
    {
        $ecodeCol = $col_uninten;
    }
    else
    {
#        print "$ecode: ECODE COL NOT FOUND!\n";
        $ecodeCol = "ECODENOTFOUND";
    }
    
    
    # Remove Fire/Burn ECODES    
    if(exists($hRow_burn{$ecode}))
    {
        $ecodeRow = "REMOVEPATIENT";
        $ecodeCol = "REMOVEPATIENT";
    }
    
    # Remove poisoning
    if(exists($hRow_poisoning{$ecode}))
    {
        $ecodeRow = "REMOVEPATIENT";
        $ecodeCol = "REMOVEPATIENT";
    }
    
    #my $ecode_int = $ecode;
    #$ecode_int =~ s/E//g;
    #$ecode_int = floor($ecode_int/10.0);
    
    # Remove accidental poisoning due to medications and other substances
    if(exists($hRow_poismed{$ecode}))
    {
        $ecodeRow = "REMOVEPATIENT";
        $ecodeCol = "REMOVEPATIENT";
    }
    # Remove complications of medical care
    if(exists($hRow_advmed{$ecode}))
    {
        $ecodeRow = "REMOVEPATIENT";
        $ecodeCol = "REMOVEPATIENT";
    }
    
    return ($ecode,$ecodeRow,$ecodeCol);
}

sub filterGCS_NTDB_forCDS
{
    my ($edgcseye, $edgcsverb, $edgcsmotor, $edgcstotal);
    $edgcseye = shift; $edgcsverb = shift; $edgcsmotor = shift; $edgcstotal = shift;
    
    if($edgcseye ne "NULL")
    {
        if($edgcseye < 1 or $edgcseye > 4)
        {
            $edgcseye = "NULL";
        }
    }
    if($edgcsverb ne "NULL")
    {
        if($edgcsverb < 1 or $edgcsverb > 5)
        {
            $edgcsverb = "NULL";
        }
    }
    if($edgcsmotor ne "NULL")
    {
        if($edgcsmotor < 1 or $edgcsmotor > 6)
        {
            $edgcsmotor = "NULL";
        }
    }
    if($edgcstotal ne "NULL")
    {
        if($edgcstotal < 3 or $edgcstotal > 15)
        {
            $edgcstotal = "NULL";
        }
    }
    
    if($edgcseye eq "NULL" and $edgcsverb ne "NULL" and $edgcsmotor ne "NULL" and $edgcstotal ne "NULL")
    {
        $edgcseye = $edgcstotal - $edgcsverb - $edgcsmotor;
    }
    if($edgcseye ne "NULL" and $edgcsverb eq "NULL" and $edgcsmotor ne "NULL" and $edgcstotal ne "NULL")
    {
        $edgcsverb = $edgcstotal - $edgcseye - $edgcsmotor;
    }
    if($edgcseye ne "NULL" and $edgcsverb ne "NULL" and $edgcsmotor eq "NULL" and $edgcstotal ne "NULL")
    {
        $edgcsmotor = $edgcstotal - $edgcseye - $edgcsverb;
    }
    if($edgcseye ne "NULL" and $edgcsverb ne "NULL" and $edgcsmotor ne "NULL" and $edgcstotal eq "NULL")
    {
        $edgcstotal = $edgcseye + $edgcsverb + $edgcsmotor;
    }

    if($edgcseye ne "NULL")
    {
        if($edgcseye < 1 or $edgcseye > 4)
        {
            $edgcseye = "NULL";
        }
    }
    if($edgcsverb ne "NULL")
    {
        if($edgcsverb < 1 or $edgcsverb > 5)
        {
            $edgcsverb = "NULL";
        }
    }
    if($edgcsmotor ne "NULL")
    {
        if($edgcsmotor < 1 or $edgcsmotor > 6)
        {
            $edgcsmotor = "NULL";
        }
    }
    if($edgcstotal ne "NULL")
    {
        if($edgcstotal < 3 or $edgcstotal > 15)
        {
            $edgcstotal = "NULL";
        }
    }
    
    return ($edgcseye, $edgcsverb, $edgcsmotor, $edgcstotal);
}

sub filterStatus{
    my ($dischdisp, $disstatus, $eddisp, $output);
    $dischdisp = shift; $disstatus = shift; $eddisp = shift;
    $output = 0;
    
    if($disstatus eq "Alive")
    {
        if($dischdisp eq "Death" or $dischdisp eq "Death (DOA)" or $dischdisp eq "Died During Treatment")
        {
            $output = 1;
        }
        if($eddisp eq "DOA (Death)" or $eddisp eq "Die in ED")
        {
            $output = 1;
        }
    }
    elsif($disstatus eq "Dead")
    {
        $output = 1;
    }
    else
    {
        print "DISSTATUS Missing! Removing record...\n";
        $output = -1;
    }
    
    return $output;
}

sub filterStatusNEW
{
    my ($hospdisp, $eddisp, $output);
    $hospdisp = shift; $eddisp = shift;
    $output = 0;
    
    if($hospdisp eq "Expired" or $eddisp eq "Died")
    {
        $output = 1;
    }
    elsif($hospdisp eq "Discharged/Transferred to a short-term general hospital for inpatient" or   # Transfered
          $hospdisp eq "Discharged/Transferred to another acute care hospital using EMS" or         # Transfered  
          $hospdisp eq "Not Applicable BIU 1" or                                                    # Missing
          $hospdisp eq "Not Known BIU 2" or                                                         # Missing
          $hospdisp eq "Not Known/Not Recorded BIU 2" or                                            # Missing
          $hospdisp eq "Not Recorded BIU 3" or                                                      # Missing
          $eddisp eq "Transferred to another hospital")                                             # Transfered
    {
#        print "Transfered/Missing! Removing record...\n";
        $output = -1;
    }
    
    return $output;
}

sub normalizeEDSYSBP
{
    my $edsysbp = shift;
    my $age = shift;

    if($age == 0)
    {
        $edsysbp = ($edsysbp-75)/9.118541033;
    }
    elsif($age == 1)
    {
        $edsysbp = ($edsysbp-85)/10.9422492401216;
    }
    elsif($age == 2)
    {
        $edsysbp = ($edsysbp-88)/10.9422492401216;
    }
    elsif($age == 3)
    {
        $edsysbp = ($edsysbp-89)/10.9422492401216;
    }
    elsif($age == 4)
    {
        $edsysbp = ($edsysbp-91)/10.9422492401216;
    }
    elsif($age == 5)
    {
        $edsysbp = ($edsysbp-95)/10.3343465045593;
    }
    elsif($age == 6)
    {
        $edsysbp = ($edsysbp-96)/10.9422492401216;
    }
    elsif($age == 7)
    {
        $edsysbp = ($edsysbp-97)/10.9422492401216;
    }
    elsif($age == 8)
    {
        $edsysbp = ($edsysbp-99)/10.3343465045593;
    }
    elsif($age == 9)
    {
        $edsysbp = ($edsysbp-100)/10.9422492401216;
    }
    elsif($age == 10)
    {
        $edsysbp = ($edsysbp-102)/10.3343465045593;
    }
    elsif($age == 11)
    {
        $edsysbp = ($edsysbp-104)/10.3343465045593;
    }
    elsif($age == 12)
    {
        $edsysbp = ($edsysbp-106)/10.3343465045593;
    }
    elsif($age == 13)
    {
        $edsysbp = ($edsysbp-108)/10.9422492401216;
    }
    elsif($age == 14)
    {
        $edsysbp = ($edsysbp-111)/10.3343465045593;
    }
    return $edsysbp;
}

sub normalizeEDRESPRATE
{
    my $edresprate = shift;
    my $age = shift;
    
    if($age == 0)
    {
        $edresprate = ($edresprate-41)/9.11854103343465;
    }
    elsif($age == 1)
    {
        $edresprate = ($edresprate-34.5)/5.8;
    }
    elsif($age == 2)
    {
        $edresprate = ($edresprate-30)/6.5;
    }
    elsif($age == 3)
    {
        $edresprate = ($edresprate-27.1)/4.1;
    }
    elsif($age == 4)
    {
        $edresprate = ($edresprate-22)/2;
    }                                                                             
    elsif($age == 5)
    {
        $edresprate = ($edresprate-21)/2;
    }                                                                             
    elsif($age == 6)
    {
        $edresprate = ($edresprate-21)/2;
    }
    elsif($age == 7)
    {
        $edresprate = ($edresprate-20)/2;
    }
    elsif($age == 8)
    {
        $edresprate = ($edresprate-19)/2;
    }
    elsif($age == 9)
    {
        $edresprate = ($edresprate-19)/2;
    }
    elsif($age == 10)
    {
        $edresprate = ($edresprate-18)/2;
    }
    elsif($age == 11)
    {
        $edresprate = ($edresprate-17)/2;
    }
    elsif($age == 12)
    {
        $edresprate = ($edresprate-17)/2;
    }
    elsif($age == 13)
    {
        $edresprate = ($edresprate-16)/2;
    }
    elsif($age == 14)
    {
        $edresprate = ($edresprate-15)/2.5;
    }
    return $edresprate;
}

sub normalizeEDPULSE
{
    my $edpulse = shift;
    my $age = shift;
    
    if($age == 0)
    {
        $edpulse = ($edpulse-129)/18;
    }
    elsif($age == 1)
    {
        $edpulse = ($edpulse-118)/15;
    }
    elsif($age == 2 or $age == 3)
    {
        $edpulse = ($edpulse-107)/13;
    }
    elsif($age == 4 or $age == 5)
    {
        $edpulse = ($edpulse-96)/13;
    }                                                                             
    elsif($age == 6 or $age == 7 or $age == 8)
    {
        $edpulse = ($edpulse-87)/12;
    }
    elsif($age == 9 or $age == 10 or $age == 11)
    {
        $edpulse = ($edpulse-83)/13;
    }
    elsif($age == 12 or $age == 13 or $age == 14)
    {
        $edpulse = ($edpulse-78)/14;
    }
    return $edpulse;
}
sub getBodyregionFromAISCODE
{
    my $aiscode = shift;
    my @array = split(//, $aiscode);
    
    my $bodyregion;
    if($array[0] == 1)
    {
        $bodyregion = "Head";    
    }
    elsif($array[0] == 2)
    {
        $bodyregion = "Face";
    }
    elsif($array[0] == 3)
    {
        $bodyregion = "Neck";
    }
    elsif($array[0] == 4)
    {
        $bodyregion = "Thorax";
    }
    elsif($array[0] == 5)
    {
        $bodyregion = "Abdomen & Pelvic Contents";
    }
    elsif($array[0] == 6)
    {
        $bodyregion = "Spine";
    }
    elsif($array[0] == 7)
    {
        $bodyregion = "Upper Extremeties";
    }
    elsif($array[0] == 8)
    {
        $bodyregion = "Lower Extremeties";
    }
    elsif($array[0] == 9)
    {
        $bodyregion = "External, Burns & Other Trauma";
    }
}

1;